Repository navigation
Fix #32 (2m/6m overflow) and #21 (PROGMEM tables) - #41
Merged
Merged
Conversation
#32: the example sketch computed (freq * 100) in a 32-bit unsigned long, overflowing at 2m frequencies (144,075,000 Hz -> 1.44e10 > 2^32-1). Switch the frequency math to uint64_t and document the 2m/6m re-lock caveat from the issue comments. #21: move the sync-vector tables to flash (PROGMEM): jt65/jt9/jt4/wspr sync vectors and the ft8 costas7x7/graymap tables, read back via pgm_read_byte(). Output is bit-identical to the pre-change library (verified by diffing symbol streams across all modes); AVR smoke build saves ~510 bytes of RAM (863 -> 353 bytes). Bumps version to 1.4.2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes in one PR:
#32 — 2m/6m frequency overflow (example sketch)
The example sketch computed
(freq * 100)in a 32-bitunsigned long. At 2m frequencies (e.g. 144,075,000 Hz) that is 1.44e10 — overflows 32 bits on AVR, silently corrupting the frequency. The frequency math now usesuint64_tthroughout (freq,(freq * 100ULL), the symbol-step term), and the example documents the 2m/6m re-lock caveat from the issue comments (manualset_freqwith pre-computed frequency and reduced tone delay above ~80 MHz). Also fixed the README's example snippet to match.#21 — move sync-vector tables to flash (PROGMEM)
jt65,jt9,jt4andwsprsync vectors, plus theft8costas7x7/graymap tables, are now stored in flash and read back viapgm_read_byte()(the portableJTEncode_pgmspace.hshim — real flash on AVR, plain memory on other architectures). This saves ~510 bytes of RAM on AVR (smoke build: 863 → 353 bytes, 42% → 17%), matching the savings measured in the issue.Version bumped to 1.4.2.
Verification
Closes #32, closes #21.